{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/employee-importance\n",
    "\n",
    "\n",
    "Runtime: 156 ms, faster than 71.95% of Python3 online submissions for Employee Importance.\n",
    "Memory Usage: 15.7 MB, less than 8.65% of Python3 online submissions for Employee Importance.\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def getImportance(self, employees: List['Employee'], id: int) -> int:\n",
    "        #4:57\n",
    "        importance_dict = dict()\n",
    "        subordinates_dict = dict()\n",
    "        for person in employees:\n",
    "            importance_dict[person.id] = person.importance\n",
    "            subordinates_dict[person.id] = person.subordinates\n",
    "        importance = 0\n",
    "        queue = [id]\n",
    "        while len(queue):\n",
    "            id = queue[0]\n",
    "            queue = queue[1:]\n",
    "            importance += importance_dict[id]\n",
    "            #print(importance_dict[id])\n",
    "            people = subordinates_dict[id]\n",
    "            queue += people\n",
    "        return importance\n",
    "        #5:09\n",
    "                 \n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
